import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
  // pc端
  {
    path: '/',
    redirect: '/homePc'
  },
  {
    path: "/homePc",
    name: "HomePc",
    component: () => import('../views/pc/home/HomePc.vue'),
  },
  {
    path: '/loginPc',
    name: 'LoginPc',
    component: () => import('../views/pc/login/LoginPc.vue'),
  },
  {
    path: '/forgetPasswordPc',
    name: 'ForgetPasswordPc',
    component: () => import('../views/pc/login/ForgetPasswordPc.vue'),
  },
  {
    path: '/mechanicalReservation',
    name: 'MechanicalReservation',
    component: () => import('../views/pc/home/mechanicalReservation/MechanicalReservation.vue'),
  },
  {
    path: '/mechanicalRent',
    name: 'MechanicalRent',
    component: () => import('../views/pc/home/mechanicalRent/MechanicalRent.vue'),
  },
  {
    path: '/mechanicalCart',
    name: 'MechanicalCart',
    component: () => import('../views/pc/home/mechanicalCart/MechanicalCart.vue'),
  },
  {
    path: '/releaseSuccess',
    name: 'ReleaseSuccess',
    component: () => import('../views/pc/home/releaseSuccess/ReleaseSuccess.vue'),
  },
  {
    path: '/engineering',
    name: 'Engineering',
    component: () => import('../views/pc/engineering/Engineering.vue'),
  },
  {
    path: '/engineeringInfo',
    name: 'engineeringInfo',
    component: () => import('../views/pc/engineering/engineeringInfo/EngineeringInfo.vue'),
  },
  {
    path: '/mechanics',
    name: 'Mechanics',
    component: () => import('../views/pc/mechanics/Mechanics.vue'),
  },
  {
    path: '/addUs',
    name: 'addUs',
    component: () => import('../views/pc/home/addUs.vue'),
  },
  {
    path: '/mechanicsInfoData',
    name: 'MechanicsInfoData',
    component: () => import('../views/pc/mechanics/mechanicsInfoData/MechanicsInfoData'),
  },
  {
    path: '/mechanicsItemInfo',
    name: 'MechanicsItemInfo',
    component: () => import('../views/pc/mechanics/mechanicsItemInfo/MechanicsItemInfo'),
  },
  {
    path: '/p_eye',
    name: 'p_eye',
    component: () => import('../views/pc/platformService/Meye.vue'),
  },
  {
    path: '/p_hst',
    name: 'p_hst',
    component: () => import('../views/pc/platformService/Hst.vue'),
  },
  {
    path: '/p_jst',
    name: 'p_jst',
    component: () => import('../views/pc/platformService/Jst.vue'),
  },
  {
    path: '/p_cpf',
    name: 'p_cpf',
    component: () => import('../views/pc/aboutUs/companyProfile.vue'),
  },
  {
    path: '/p_ctu',
    name: 'p_ctu',
    component: () => import('../views/pc/aboutUs/contactUs.vue'),
  },
  {
    path: '/p_dph',
    name: 'p_dph',
    component: () => import('../views/pc/aboutUs/developmentHistory.vue'),
  },
  {
    path: '/p_dinfor',
    name: 'p_dinfor',
    component: () => import('../views/pc/news/DInfor.vue'),
  },
  {
    path: '/p_dindetail',
    name: 'p_dindetail',
    component: () => import('../views/pc/news/DinDetails.vue'),
  },
  {
    path: '/personal',
    name: 'Personal',
    component: () => import('../views/pc/personal/Personal.vue'),
  },
  {
    path: '/mechanicsInfo',
    name: 'MechanicsInfo',
    component: () => import('../views/pc/personal/mechanicalMaintenance/MechanicsInfo.vue'),
  },
  {
    path: '/addMechanics',
    name: 'AddMechanics',
    component: () => import('../views/pc/personal/AddMechanics.vue'),
  },
  {
    path: '/projectInfo',
    name: 'ProjectInfo',
    component: () => import('../views/pc/personal/projectManagement/ProjectInfo.vue'),
  },
  // 消息
  {
    path: '/systemMessage',
    name: 'SystemMessage',
    component: () => import('../components/SystemMessage.vue'),
  },
  // 实名认证
  {
    path: '/realNameInfo',
    name: 'RealNameInfo',
    component: () => import('../views/pc/personal/serviceCertification/RealNameInfo'),
  },
  // 实名认证详情
  {
    path: '/realNameInfoData',
    name: 'RealNameInfoData',
    component: () => import('../views/pc/personal/serviceCertification/RealNameInfoData'),
  },
  // 企业认证
  {
    path: '/enterpriseCertification',
    name: 'EnterpriseCertification',
    component: () => import('../views/pc/personal/serviceCertification/EnterpriseCertification'),
  },
  // 企业认证详情
  {
    path: '/enterpriseCertificationInfo',
    name: 'EnterpriseCertificationInfo',
    component: () => import('../views/pc/personal/serviceCertification/EnterpriseCertificationInfo'),
  },
  // 加入企业
  {
    path: '/addEnterprise',
    name: 'AddEnterprise',
    component: () => import('../views/pc/personal/serviceCertification/AddEnterprise'),
  },
  // 加入企业详情
  {
    path: '/addEnterpriseInfo',
    name: 'AddEnterpriseInfo',
    component: () => import('../views/pc/personal/serviceCertification/AddEnterpriseInfo'),
  },
  // 用户协议
  {
    path: '/messageData',
    name: 'MessageData',
    component: () => import('../components/MessageData.vue'),
  },
]
const router = new VueRouter({
  routes,
  mode:'history',
  base: process.env.BASE_URL,
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
        return savedPosition
    } else {
        return { x: 0, y: 0 }
    }
  }
})
//解决重复点击
const VueRouterPush =VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}
export default router
